package aex.service;



import java.io.Serializable;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import aex.dao.CategoryEditerDao;
import aex.domain.CategoryEditer;
import aex.domain.Puser;



@Transactional(readOnly = false)
@Service(CategoryEditerService.SERVICE_NAME)

public class CategoryEditerService  {

	
	public static final String SERVICE_NAME="aex.service.CategoryEditerService";
	/**
	 * 以注解的形式让spring为我们注入dao的实现类
	 */
	@Resource(name = CategoryEditerDao.SERVICE_NAME)
	public CategoryEditerDao dao;
	
	public CategoryEditerService() {
		
	}
	public CategoryEditer findByID(Serializable id) {
		return dao.findObjectByID(Integer.parseInt(id+""));
	}
	public void deleteById(Serializable id) {
		dao.deleteObjectByIDs(Integer.parseInt(id+""));
	}
	public void save(CategoryEditer obj) {
		dao.save(obj);
	}
	public void update(CategoryEditer obj) {
		dao.merge(obj);
	}
	public CategoryEditer findByUserAndCategory(Integer puId, Integer acId) {
		List<CategoryEditer> list=dao.findCollectionByConditionNoPage(" and tName.articleCategory="+acId
				+ "and tName.puser="+puId, null, null);
		 if(list.size()>0){
			 return list.get(0);
		 }
		 return null;
	}
}
